Skip to main content
Version: 3.7

Configure Endpoints

Endpoints in API Manager are the specific URLs or paths through which external clients can access the functionalities provided by an API. These endpoints define the entry points for making requests to interact with the API's resources, allowing clients to perform various operations such as retrieving data, updating information, or executing specific tasks.

Configure a Production Endpoint Using Static Routing (API Level)

  1. Navigate to the API's End Points tab.

The Screen appears as shown below.

endpoints

  1. Ensure that API Level tab is selected.
info

The Resource Level tab is disabled by default; it is enabled after the Backend is selected/Basepath is updated and saved in API level.

  1. Ensure that Type of Routing is selected as Static Routing.

  2. Select Backendpoint from the drop down.

  3. Select the Protocol as either HTTP or HTTPS as per the requirement.

  4. Enter the Basepath.

info

The basepath is automatically retrieved from the selected backend. Whereas the user can update it if necessary.

info

By default, the Backend Type is set to the same as the API Type.

  1. Update/select the Backend Type if necessary.

  2. Select Gateway you want to map from the drop down if necessary.

  3. Select Endpoint Security from the drop down.

info

None: Choose None if you do not want any security for the endpoint.

Linked to Backend: When authentication is linked to the backend, the Gateway replaces subscription-level credentials in message headers with credentials provided at the backend server security level and authentication occurs at the backend server level.

Basic Authentication: When the user selects Basic Authentication, the Gateway authenticates the user credentials (User ID and Password) and then replaces them with those from backend security to allow authentication at the backend endpoint level.

Pass-through: When the user selects pass-through authentication as the API endpoint security, the message is allowed to pass through the Gateway without being processed or altered and the backend server authenticates the credentials passed in the message before returning the response to the client.

WS Security (Only for SOAP APIs): WS Security is similar to Basic Authentication, however it is designed for SOAP messages.

note

If Basic Authentication or WS Security is selected as Endpoint Security, enter the User name and Password.

basicauthentication

wssecurity

  1. Click Save as Draft.

On saving, the confirmation message appears as shown below.

endpointssaved

Configure a Sandbox Endpoint

  1. Navigate to the API's End Points tab.

  2. Scroll down to the sandbox section.

The screen appears as shown below.

sandboxendpoint

info

Sandbox is disabled by default.

  1. Enable the toggle to enable the Sandbox section.

  2. Ensure that Type of Routing is selected as Static Routing.

  3. Select Backendpoint from the drop down.

  4. Select the Protocol as either HTTP or HTTPS as per the requirement.

  5. Enter the Basepath.

  6. Select Gateway you want to map from the drop down if necessary.

  7. Enter the Exposure Path.

info

Exposure Path is automatically obtained from the selected backend and the user may modify it if necessary.

  1. Select Endpoint Security from the drop down.
note

If Basic Authentication or WS Security is selected as Endpoint Security, enter the User name and Password.

basicauthentication

wssecurity

  1. Click Save as Draft.

On saving, the confirmation message appears as shown below.

endpointssaved

Configure a Production Endpoint Using Dynamic Routing (API Level)

info

When configuring Endpoints with Dynamic Routing scripts, use the Backend Server Name (not the port or IP) to route requests to the appropriate Backend Server.

  1. Navigate to the API's End Points tab.

The screen appears as shown below.

endpointdynamicapi

  1. Enter the Script for Dynamic Routing.
info

By default, the Backend Type is set to the same as the API Type.

  1. Update/select the Backend Type if necessary.

  2. Select Gateway you want to map from the drop down if necessary.

  3. Select Endpoint Security from the drop down.

info

Exposure Path is automatically obtained from the selected backend and the user may modify it if necessary.

  1. Click Save as Draft.

On saving, the confirmation message appears as shown below.

endpointssaved1

The following is the method used in Dynamic Routing script.

Method nameMethod Description
routeRequest()Use this method to set the actual URI dynamically

The helper methods used in Dynamic Routing script are as follows:

Method nameMethod DescriptionParameterParameter Description
getHeaderValue(Key)Use this method to get http header value for the incoming requestkeykey passed in http request header
setTarget(protocol, backendName, basePath)Use this method to set the actual URI for the real backendprotocolshould be http or https
backendNameName of the Backend where the request will be processed
basePathActual Base URL

Sample Dynamic Routing script

    var obj = new Object();
obj.routeRequest = function(dynamicRouting)
{
var headerValue = dynamicRouting.getHeaderValue("X-SSL-client-s-dn");
var result = headerValue.split("CN=");
StringFinalHeaderVal = result[result.length-1];
if(StringFinalHeaderVal == "PERF")
{
dynamicRouting.setTarget("http,ThbsOSBPerf,/sim/autostub/Enterprise/JaxwsWebservice/jaxwsWebservice");
}else{
dynamicRouting.setTarget("http,ThbsOSBSoap,/sim/autostub/Enterprise/Webservice/jaxwsWebservice");
}
return dynamicRouting;
}
info

When using a dynamic routing script with backend server dependencies, ensure that all servers are propagated to the appropriate Gateways regardless of the API version.

Configure a Endpoint at Resource Level (Static)

info

The Resource Level tab is disabled by default; it is enabled after the Backend is selected/ Basepath is updated and saved in the API level.

  1. Navigate to the API's End Points tab.

The screen appears as shown below.

resourcelevelendpoint

  1. Select the Resource Level tab.
info

The Routing Type displayed in the Resource Level ID is determined by the Type of Routing set at the API level.

  1. Click the Edit icon of the respective resource.

Routing Type dialog box appears as shown below.

  1. Select the Routing as Static.

  2. Select Backendpoint from the drop down.

  3. Select the Protocol as either HTTP or HTTPS as per the requirement.

  4. Enter the Basepath.

  5. Click Save.

On saving, the Routing type of the respective resource is set to Static.

staticresourcelevelendpoint1

Configure a Endpoint at Resource Level (Dynamic)

info

The Resource Level tab is disabled by default; it is enabled after the Backend is selected/ Basepath is updated and saved in the API level.

  1. Navigate to the API's End Points tab.

The screen appears as shown below.

resourcelevelendpoint1

  1. Select the Resource Level tab.
info

The Routing Type displayed in the Resource Level ID is determined by the Type of Routing set at the API level.

  1. Click the Edit icon of the respective resource.

Routing Type dialog box appears as shown below.

  1. Select the Routing as Dynamic.

  2. Enter the Script for Dynamic Routing.

  3. Click Save.

On saving, the Routing type of the respective resource is set to Dynamic.

dynamicresourcelevelendpoint1

Sample Dynamic Routing script

    var obj = new Object();
obj.routeRequest = function(dynamicRouting){
var xml = dynamicRouting.getPayload();
var xpath = "//orderStatusEvent/@orderCode";
var namespace = "";
var value = "CB2z8ule1njiwd-2uxwi";
var type = "attribute";
if (dynamicRouting.isXmlElement(xml, xpath, namespace, value, type)) {
dynamicRouting.setTarget("http,Mock Backend,/xmlValidation/mock");
} else {
dynamicRouting.setTarget("http,ThbsBackend,/services/helloservice_1_0");
}
return dynamicRouting;
}